

*****************************************
*****************************************
****Presidential Campaigns and the Fundamentals Reconsidered
****Peter K. Enns and Brian Richman
****Journal of Politics
****Replication: Vote Intentions During the 2000 Presidential Campaign
*****************************************
*****************************************

***Set Working Directory
cd ""

use "EnnsRichman_NAES_VoteIntentions.dta", clear
pause on

******************************
**Use Coarsened Exact Matching to match the data
******************************

**Requires Stefano Iacus, Gary King, Giuseppe Porro's CEM: Coarsened Exact Matching Software (http://gking.harvard.edu/cem)
**Note, CEM output corresponds with Table A-6, Column 2 in the Supplementary Appendix
cem zknow18 zexp10 zeduc  ztot_presad_exp3 noaddata(#0) cemperiod, treatment(int_winner)

save "EnnsRichman_NAES_VoteIntentionsMatched.dta", replace

pause
*******************************
**Figure 2(b)
**Throughout 2000 Campaign
*******************************

**Create temporary datafile to use for analysis named "match_setup"
**"match_setup" has all of data setup and will be called to begin each calculation below

*Declare name of tempfile
tempfile match_setup

*Save tempfile
save `match_setup', replace

**Closes postfile dataset if dataset is already open
capture postclose results

postfile results cemperiod b_int_winner low_int_winner hi_int_winner using "overtimeanalysis.dta", replace


forval i = 1/28 {

		**Clear all data
		clear
	
		**Use tempfile with all data setup
		use `match_setup'


		**Use only one time window at a time
		keep if cemperiod == -`i'

logit  correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [iweight=cem_weights]

post results (-`i') (_b[int_winner]) (_b[int_winner]-1.96*_se[int_winner]) (_b[int_winner]+1.96*_se[int_winner])
}

**Clear all data
clear


**Close postfile dataset
postclose results

**Open results dataset
use "overtimeanalysis.dta"

**Note, Figure 2(b) in text generated using Excel
twoway line hi_int_winner b_int_winner low_int_winner cemperiod

pause

clear all
set mem 100000k
use "EnnsRichman_NAES_VoteIntentionsMatched.dta", clear


***************************************
**Relationshp b/t Caring Which Party Wins and Don't Know Responses to Demographic Questions
**Reported in the text and Table A-3 of Appendix
***************************************
**Full range of don't know responses
logit int_winner dkna_dem18_perc
prchange

**only analyzing between 0 and 3 DK responses
logit int_winner dkna_dem18_perc if dkna_dem18<=3
prchange


******************************
**Figures 1(a) and 1(b) in Text
**Percent who Care about Election and Percent Correction Vote Intention
******************************

**1(a)
**NOTE: Series smoothed with 7-day prior moving average prior to plotting figure
tab mydate ck04 if  days_elec>=-207 & days_elec<0 & ck04<3, row nof

**1(b)
**NOTE: Series smoothed with 7-day prior moving average prior to plotting figure
tab mydate correct_pv15all if int_winner==1 & days_elec>=-207 & days_elec<0, row nof

tab mydate correct_pv15all if int_winner==0 & days_elec>=-207 & days_elec<0, row nof


pause


*******************************
**Figure 2(a) in Text
**Relationship b/t Motivation, Campaign Information, and Correction Vote Intention
*******************************

logit  correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [iweight=cem_weights]
*Note: even though we exact match on noaddata, we include it because it is coded as a zero in ztot_presad_exp3
lroc

pause
******************************
**Robustness Checks Reported in Footnotes
******************************

**Footnote 7
**Results robust to parsimonious fundamentals model

	logit   intvote2party_gore zpiddem zclintapp if days>=-7 & days<0
	**Predicted values
	predict pv2

	**Create variable for "correct" vote choice
	gen correct_pv2 = .
		replace correct_pv2 = 1 if (intvote2party_gore == 0 & pv2 < .5 & pv2>=0) | (intvote2party_gore == 1 & pv2 > .5 & pv2<=1) 
		replace correct_pv2 = 0 if (intvote2party_gore == 0 & pv2 >= .5 & pv2<=1) | (intvote2party_gore == 1 & pv2 <= .5 & pv2>=0) 

	logit  correct_pv2 int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [iweight=cem_weights]
	*Note: even though we exact match on noaddata, we include it because it is coded as a zero in ztot_presad_exp3


***Footnote 15
***Robust to controlling for battleground state
xi: logit  correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata i.battleground [iweight=cem_weights]

***Footnote 16
***Correlation among predictors
cor int_winner zexp10 zknow18 zeduc ztot_presad_exp3

***Footnote 22
***Drop presidential ad variable to analyze entire campaign period
logit  correct_pv15all int_winner zknow18 zeduc  zexp10 [iweight=cem_weights]

pause
********************************
**Magnitude of Effect
**As reported in the Text
********************************
***Requires Michael Tomz, Jason Wittenberg, Gary King's CLARIFY: Software for Interpreting and Presenting Statistical Results
***(http://gking.harvard.edu/clarify).

estsimp logit correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [aweight=cem_weights]
*care about election
setx  (zknow18 zeduc  ztot_presad_exp3 zexp10) mean noaddata 0
simqi, fd(prval(1)) changex(int_winner 0 1)
*campaign info vars
setx  int_winner 0 noaddata 0
simqi, fd(prval(1)) changex(zknow18 p20 p80 zeduc p20 p80 ztot_presad_exp3 p20 p80 zexp10 p20 p80)

pause



*******************************************
***Supplementary Appendix
*******************************************

**Figure A-1
**"Englightened" Fundamental Weights

logit  intvote2party_gore zpiddem zclintapp zideollib  zmood zmoral zecon black hispanic south zinccontmed zeduc zage female otherrace incomedkna  if days>=-7 & days<0
**Area Under ROC Curve
lroc

**Note, Table A-3 reported above.

**Table A-4
**IV Analysis
**strength of instrument
reg int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata dkna_dem18_perc
test dkna_dem18_perc
**IV Analysis
biprobit (int_winner = dkna_dem18_perc) (correct_pv15all = int_winner zknow18 zexp10 zeduc ztot_presad_exp3 noaddata), robust

**Table A-5
**Campaign Knowledge and Exposure to Presidential Campaign Ads
**recode relevant variables to range from 0 to 1
**Requires: _gstd01 written by Stas Kolenikov
**To download: net from http://web.missouri.edu/~kolenikovs/stata
egen presadexp01 = std01(ztot_presad_exp3)
egen educ01 = std01(zeduc)
egen inc01 = std01(zinccontmed)
egen age01 = std01(zage)
egen know01 = std01(zknow18)

reg know01 presadexp01 noaddata educ01 black otherrace hispanic south inc01 incomedkna age01 female 
drop know01 inc01 age01 educ01 presadexp01

**Supplementary Appendix Footnote 9
**Robust to Continuous Measure of Probability of Expressing Vote Intention in line with Fundamentals

gen prob_cv15 = .
	replace prob_cv15 = (1-pv15) if intvote2party_gore == 0 & pv15 < .5 & pv15>=0
	replace prob_cv15 = pv15     if intvote2party_gore == 1 & pv15 > .5 & pv15<=1
	replace prob_cv15 = (1-pv15) if intvote2party_gore == 0 & pv15 >= .5 & pv15<=1 
	replace prob_cv15 = pv15     if intvote2party_gore == 1 & pv15 <= .5 & pv15>=0

*estimate fundamentals w/o economic var because not asked prior to week -31

gen prob_cv14=.
	replace prob_cv14 = (1-pv14_noecon) if intvote2party_gore == 0 & pv14_noecon < .5 & pv14>=0
	replace prob_cv14 = pv14_noecon     if intvote2party_gore == 1 & pv14_noecon > .5 & pv14<=1
	replace prob_cv14 = (1-pv14_noecon) if intvote2party_gore == 0 & pv14_noecon >= .5 & pv14<=1
	replace prob_cv14 = pv14_noecon     if intvote2party_gore == 1 & pv14_noecon <= .5 & pv14>=0

gen prob_cv15all = prob_cv15 
replace prob_cv15all = prob_cv14 if weeks_elec<-31
reg prob_cv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [iweight=cem_weights]
drop prob_cv15 prob_cv14 prob_cv15all

pause
**Table A-6, Colum 1
ttest zknow18, by(int_winner)
ttest zexp10, by(int_winner)
ttest zeduc, by(int_winner)
ttest ztot_presad_exp3, by(int_winner)
ttest noaddata, by(int_winner)
ttest cemperiod, by(int_winner)
**Note, Imbalance Statistic calculated with "imb" command
**i.e., imb zknow18 zexp10 zeduc  zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata cemperiod, tr(int_winner)

**Table A-7
**Column 1
logit  correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  
**Column 2
logit  correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [iweight=cem_weights]
**Column 3
cem zknow18 zexp10 zeduc  ztot_presad_exp3 noaddata(#0) cemperiod, treatment(int_winner) autocuts(fd)
logit  correct_pv15all int_winner zknow18 zeduc  ztot_presad_exp3 zexp10 noaddata  [iweight=cem_weights]

